﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.Supervise.Model.Enum;

public partial class Admin_CurrentUserInfo : BasePage
{ 
    public Admin_CurrentUserInfo()
    {
        this.ModuleNo = Module.用户信息管理.ToString();
        this.PageOperateType = OperateType.用户资料.ToString();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strUserID = CurrentAccount.GetUser().UserID;
            lblUserID.Text = strUserID;

            this.labUserName.Text = CurrentAccount.GetUser().UserName;
            this.labOrgName.Text = CurrentAccount.GetUser().Org.OrgName;
        }

    }
    protected void btnUpdateOrgName_Click(object sender, EventArgs e)
    {
        if (this.btnUpdateOrgName.Text == "修改信息")
        {
            this.mlvUser.ActiveViewIndex = 1;
            this.lblUserID2.Text = CurrentAccount.GetUser().UserID;
            this.txtUserName.Text = CurrentAccount.GetUser().UserName;
            this.txtUserOrg.Text = CurrentAccount.GetUser().Org.OrgName;

            this.btnUpdateOrgName.Text = "确认修改";
        }
        else
        {

            //HZ.Supervise.IBLL.IBLL_User iUser = HZ.Supervise.BLLFactory.IBLL_User();
            //string strUserID = this.lblUserID.Text;
            //string strUserName = this.txtUserName.Text.Trim();
            //string strOrgname = this.txtUserOrg.Text.Trim();
            //try
            //{
            //    int iresout = iUser.ModifyOrgNameUserName(strUserID, strOrgname, strUserName);
            //    HZ.Supervise.Model.View.User mUser = CurrentAccount.GetUser();
            //    mUser.UserName = strUserName;
            //    mUser.OrgName = strOrgname;
            //    CurrentAccount.SetUser(mUser);
            //    this.txtUserOrg.Visible = false;
            //    this.txtUserName.Visible = false;
            //    this.labOrgName.Visible = true;
            //    this.labUserName.Visible = true;
            //    this.labUserName.Text = this.txtUserName.Text.Trim(); //CurrentAccount.GetUser().UserName;
            //    this.labOrgName.Text = this.txtUserOrg.Text.Trim();//CurrentAccount.GetUser().OrgName;
            //    this.btnUpdateOrgName.Text = "修改信息";
            //    this.labMsg.Visible = true;
            //    this.labMsg.Text = "修改成功！";                             

            //    //Response.Write("<script>alert('修改成功！')</script>");
            //}
            //catch (Exception ex)
            //{

            //    this.txtUserOrg.Visible = false;
            //    this.txtUserName.Visible = false;
            //    this.labOrgName.Visible = true;
            //    this.labUserName.Visible = true;
            //    this.labUserName.Text = CurrentAccount.GetUser().UserName;
            //    this.labOrgName.Text = CurrentAccount.GetUser().OrgName;
            //    this.btnUpdateOrgName.Text = "修改信息";
            //    this.labMsg.Visible = true;
            //    this.labMsg.Text = "修改不成功！" + ex.Message;

            //}

        }
    }

}
